<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<link href="../../../js/bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet">
		<link rel="stylesheet" type="text/css" href="../../../css/reset.css" />
		<link rel="stylesheet" type="text/css" href="../../../css/footer.css" />
		<link rel="stylesheet" type="text/css" href="../../../css/nearby.css" />
		<style type="text/css">
			body {
				background: #fdfdfd;
			}
			
			.present {
				color: #a3a3a3;
			}
			
			.item-title {
				padding: 0 0.085rem;
			}
			
			.address {
				margin-bottom: 0.1805rem;
			}
			
			.icon {
				margin-right: 0.2083rem;
			}
			/*修改底部字体颜色*/
			
			.foot:nth-child(2) {
				color: #e83023;
			}
			
			.itemHref {
				width: 100%;
				height: 100%;
				display: block;
			}
			
			.itemHref:hover {
				text-decoration: none;
			}
		</style>
		<script src="../../../js/flexible.min.js" type="text/javascript" charset="utf-8"></script>

	</head>

	<body>
		<div id="wrap">
			<div id="main">
				<div id="header">
					<a id="headImg" href="../colalition.html"><img class="headImg" src="../../../images/12.png" /></a>
					<p id="headTitle">商家搜索结果</p>
				</div>
				<div id="content">
					<div class="search">
						<input style="width: 100%" id="shopName" type="text" class="search-input" />
						<!--<div class="horizon"></div>-->
						<!--<input style="width: 13%;border-radius: 11px;background:#ed5f69;text-align: center;    line-height: inherit;height: 0.7467rem;padding-left: 0px;color: #fff" type="button" class="search-input" onclick="getTableListData()" value="搜索" />-->			
					</div>
					<div class="items-wrapper" id="items">
					</div>
				</div>
			</div>
			<div id="foot" class="row">
				<a class="foot col-xs-3 col-sm-3" href="../../kaoqin/index2.html">
					<img class="footImg" src="../../../images/15.png" />
					<p>管理</p>
				</a>
				<a class="foot col-xs-3 col-sm-3" href="../colalition.html">
					<img class="footImg" src="../../../images/14.png" />
					<p>联盟</p>
				</a>
				<a class="foot col-xs-3 col-sm-3" href="../../store/store.html">
					<img class="footImg" src="../../../images/11.png" />
					<p>商城</p>
				</a>
				<a class="foot col-xs-3 col-sm-3" href="../../personage/personIndex.html">
					<img class="footImg" src="../../../images/13.png" />
					<p>我的</p>
				</a>
			</div>
		</div>
	</body>
	<script src="../../../js/jquery-2.2.3.min.js"></script>
	<script src="../../../js/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
	<script src="../../../js/rhAdmin.js" type="text/javascript" charset="utf-8"></script>
	<script>
		var shopName;
			var url = window.location.href;
			if(url.indexOf("?") > 0 ){
				shopName = url.split("?")[1];
			}
			else{
				shopName = "";
			}
			$().ready(function() {
				getTableListData2(shopName);
				document.onkeydown=keyDownSearch;  
			    function keyDownSearch(e) {
			        // 兼容FF和IE和Opera    
			        var theEvent = e || window.event;    
			        var code = theEvent.keyCode || theEvent.which || theEvent.charCode;    
			        if (code == 13) {    
			            getTableListData();//具体处理函数    
			            return false;    
			        }    
		        return true;    
		    }
			
		})
		function getTableListData(shopName){
			var url = "http://47.104.13.109:80/mall-service/shop/mohuList?shopName"+shopName;
			var shopName = document.getElementById("shopName").value;   
			if(shopName != null){
				url += "&shopName="+shopName;
			}
			$.ajax({
				url: url,
				type: "GET",
				success: function(data) {
					//console.log(data);
					var tpl = "";
					if(data != null){
						for(var i=0;i<data.length;i++){
							tpl+='<div class="item">' +
							'<a class="itemHref" href="../commodity_details/commodity_details.html?shopId=' + data[i].shopId + '"><span class="item-title">' + data[i].shopName + '</span>' +
							'<img class="item-pic" src="' + data[i].shopPic + '"/>' +
							'<p class="address"><img class="icon" src="../../../images/coalltion/newadress.png">' + "" + '</p>' +
							'<p class="present"><img class="icon" src="../../../images/coalltion/08.png">' + data[i].shopAdd +
							'</p>' +
							'</a></div>';
						}
						document.getElementById('items').innerHTML = tpl;
					}		
					
				},
				error: function(e) {
					//console.log('获取附近商家失败:', e);
				}
			})
		}
		function getTableListData2(shopName){
			var url = "http://47.104.13.109:80/mall-service/shop/mohuList?shopName"+shopName;  
			if(shopName != null){
				url += "&shopName="+shopName;
			}
			$.ajax({
				url: url,
				type: "GET",
				success: function(data) {
					//console.log(data);
					var tpl = "";
					if(data != null){
						for(var i=0;i<data.length;i++){
							tpl+='<div class="item">' +
							'<a class="itemHref" href="../commodity_details/commodity_details.html?shopId=' + data[i].shopId + '"><span class="item-title">' + data[i].shopName + '</span>' +
							'<img class="item-pic" src="' + data[i].shopPic + '"/>' +
							'<p class="address"><img class="icon" src="../../../images/coalltion/newadress.png">' + data[i].shopAdd + '</p>' +
							'<p class="present"><img class="icon" src="../../../images/coalltion/08.png">' + data[i].shopSign +
							'</p>' +
							'</a></div>';
						}
						document.getElementById('items').innerHTML = tpl;
					}		
					
				},
				error: function(e) {
					//console.log('获取附近商家失败:', e);
				}
			})
		}
	</script>

</html>